home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / comm / tcp / EasyAmiTCP20.lha / EasyAmiTCP20.rexx < prev    next >
OS/2 REXX Batch file  |  1996-03-31  |  5KB  |  199 lines

  1. /*
  2. ** $VER: EasyAmiTCP v2.0 (31.03.96) 5200
  3. ** Copyright (c) 1996 Arne Seime
  4. */
  5. OPTIONS RESULTS
  6. SIGNAL ON HALT
  7.  
  8. /* Some declarations */
  9. opt.cd = 0
  10. opt.7wire = 0
  11. opt.noeofmode = 0
  12. opt.useodu = 0
  13. opt.shared = 0
  14.  
  15. /* Retrieving old information */
  16. /* User names */
  17.  
  18. OK = open(users,'Amitcp:bin/startnet')
  19. if OK ~=1 then
  20. do
  21.     Say "AmiTCP/IP is not properly installed."
  22.     Say "File AmiTCP:bin/Startnet not found."
  23.     Say "Exiting..."
  24.     Exit
  25. end
  26. line = ""
  27. do while left(line,6) ~= 'FailAt'
  28.     line = readln(users)
  29.     if left(line,9) = '.def USER' then
  30.     do
  31.         user = substr(line,11)
  32.         user = strip(user)
  33.     end        
  34.  
  35. /* Netmask & Gateway */
  36.     if left(line,9) = '.def MASK' then
  37.     do
  38.         Xnetmask = substr(line,11)
  39.         Xnetmask = strip(Xnetmask)
  40.     end
  41.     if left(line,7) = '.def GW' then
  42.     do
  43.         Xgateway = substr(line,9)
  44.         Xgateway = strip(Xgateway)
  45.     end        
  46.     if left(line,10) = '.def S2OPT' then
  47.     do
  48.         Sana2Opts = substr(line,13)
  49.         Sana2Opts = left(sana2opts,(length(sana2opts)-1))
  50.     end
  51.  
  52. end
  53. Call Close(users)
  54. OK = open(informa,'Amitcp:db/passwd')
  55. if OK ~=1 then
  56. do
  57.     Say "AmiTCP/IP is not properly installed."
  58.     Say "File AmiTCP:db/passwd not found."
  59.     Say "Exiting..."
  60.     Exit
  61. end
  62. do while ~eof(informa)
  63.     usx = readln(informa)
  64.     luser = length(user)
  65.     if left(usx,((luser)+1)) = user'|' then
  66.     do
  67.         Dig = 0
  68.         do y = 1 to 6
  69.             Dig = pos('|',usx,(1+Dig))
  70.             line.y = Dig
  71.         end
  72.     
  73.     XPasswd = substr(usx,((line.1)+1),(line.2-line.1-1))
  74.     XUserID = substr(usx,((line.2)+1),(line.3-line.2-1))
  75.     XGroupID = substr(usx,((line.3)+1),(line.4-line.3-1))
  76.     XRName = substr(usx,((line.4)+1),(line.5-line.4-1))
  77.     XHome = substr(usx,((line.5)+1),(line.6-line.5-1))
  78.     end
  79. end
  80. Call Close(informa)
  81.  
  82. /* Name servers & domain */
  83. OK = open(resolv1,'Amitcp:db/resolv.conf')
  84. do while ~eof(resolv1)
  85.     line = readln(resolv1)
  86.     if left(line,6) = "DOMAIN" then
  87.     do
  88.         Xdomain = substr(line,8)
  89.         Xdomain = strip(Xdomain)
  90.     end
  91.     if left(line,6) = "NAMESE" then
  92.     do
  93.         Xnameserver = substr(line,12)
  94.         Xnameserver = strip(Xnameserver)
  95.     end
  96. end
  97. Call Close(resolv1)
  98.  
  99. /* Get old Sana2 PPP configuration */
  100. config = sana2opts
  101. Xdevice = word(config,1)
  102. Xunit = word(config,2)
  103. Xbaud = word(config,3)
  104. XIP = word(config,4)
  105. Xoptions = words(config)
  106. do i = 5 to (Xoptions)
  107.     opt = word(config,(i))
  108.     if opt = "CD" then opt.cd = 1
  109.     if opt = "7WIRE" then opt.7wire = 1
  110.     if opt = "USEODU" then opt.useodu = 1
  111.     if opt = "NOEOFMODE" then opt.noeofmode = 1
  112.     if opt = "SHARED" then opt.shared = 1
  113.     if left(opt,3) = "MTU" then XMTU = substr(opt,5)
  114.     if left(opt,10) = "DIALSCRIPT" then XDial = substr(opt,12)
  115. end
  116. Aboutstring = 'EasyAmiTCP is © Arne Seime 1996'
  117. address EASYAMITCP20
  118. request TITLE '"About EasyAmiTCP"' GADGETS '"OK"' STRING Aboutstring
  119. window ID PAGE TITLE '"EasyAmiTCP v2.0"' COMMAND '"quit"' PORT EASYAMITCP20
  120.     group REGISTER '"Names"' '"IP-Adressing"' '"Serial"' '"PPP Options"'
  121.         group HORIZ
  122.                 group
  123.                 label SINGLE '"Default Name:"'
  124.                 label SINGLE '"Real Name:"'
  125.                 label SINGLE '"User ID:"'
  126.                 label SINGLE '"Group ID:"'
  127.                 label SINGLE '"Home directory:"'
  128.             endgroup
  129.             group
  130.                 string ID DEFNAME user
  131.                 string ID REALNAME XRname
  132.                 slider ID USERID MIN 0 MAX 1000 LEVEL XUserID
  133.                 slider ID GROUPID MIN 0 MAX 1000 LEVEL XGroupID
  134.                 popasl ID HOME COMMAND '"list ID SLST UPDATE INSERT %s"' PORT DEMO NODE '"popasl"' DIRS CONTENT XHOME
  135.             endgroup
  136.         endgroup
  137.         group HORIZ
  138.             group
  139.                 label SINGLE '"IP Address:"'
  140.                 label SINGLE '"NetMask:"'
  141.                 label SINGLE '"Nameserver:"'
  142.                 label SINGLE '"Gateway:"'
  143.                 label SINGLE '"Domain Suffix:"'
  144.             endgroup
  145.             group
  146.                 string ID IPADRESS XIP
  147.                 string ID NETMASK XNetmask
  148.                 string ID NAMESERVER XNameserver
  149.                 string ID GATEWAY XGateway
  150.                 string ID DOMAIN XDomain
  151.             endgroup
  152.         endgroup
  153.         group HORIZ
  154.             group
  155.                 label SINGLE '"Serial Driver:"'
  156.                 label SINGLE '"Unit:"'
  157.                 label SINGLE '"Baud Rate:"'
  158.                 label SINGLE '"MTU:"'
  159.                 label SINGLE '"Dial-Script:"'
  160.             endgroup
  161.             group
  162.                 popasl ID SERIAL COMMAND '"list ID XDevice UPDATE INSERT %s"' PORT DEMO NODE '"popasl"' CONTENT XDEvice
  163.                 slider ID UNIT MIN 0 MAX 10 LEVEL XUnit
  164.                 cycle ID BAUD COMMAND '"cycle ID CDSP %s"' PORT DEMO NODE '"Baudrate"' '"2400"' '"9600"' '"19200"' '"38400"' '"57600"' '"115200"'
  165.                 slider ID MTU MIN 1000 MAX 1500 LEVEL XMtu
  166.                 popasl ID DIALSCRIPT COMMAND '"list ID SLST UPDATE INSERT %s"' PORT DEMO NODE '"popasl"' CONTENT XDIAL
  167.             endgroup
  168.         endgroup
  169.         group HORIZ
  170.             group
  171.                 label SINGLE '"Carrier Detect:"' 
  172.                 label SINGLE '"CTS/RTS:"'
  173.                 label SINGLE '"No EOF-Mode:"'
  174.                 label SINGLE '"Use ODU:"'
  175.                 label SINGLE '"Shared Mode:"'
  176.             endgroup
  177.             group
  178.                         check ID CD SELECT opt.cd
  179.                         check ID CTS SELECT opt.7wire
  180.                         check ID NOEOF SELECT opt.noeofmode
  181.                         check ID USEODU SELECT opt.useodu
  182.                         check ID SHARED SELECT opt.shared
  183.             endgroup
  184.         endgroup
  185.     endgroup
  186.     group HORIZ
  187.         button COMMAND '"muirexx:easygo"' '"Config"'
  188.         button COMMAND 'quit' PORT EASYAMITCP20 '"Exit"'
  189.     endgroup
  190.     group
  191.                 gauge ID ACTION LEVEL 0 HELP '"Progress display"' LABEL "%ld percent done..."
  192.     endgroup
  193. endwindow
  194. cycle ID BAUD XBaud
  195. call setclip(defname,option.defname)
  196. call setclip(password,xpasswd)
  197. call setclip(s2opts,sana2opts)
  198. exit
  199.